package br.ufrn.cloud.gae.teamgae;

import java.io.IOException;
import javax.servlet.http.*;

import br.ufrn.cloud.gae.teamgae.jdo.DAO;
import br.ufrn.cloud.gae.teamgae.model.Jogador;
import br.ufrn.cloud.gae.teamgae.model.Time;

@SuppressWarnings("serial")
public class TeamGAEServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		resp.setContentType("text/plain");
		resp.getWriter().println("Hello, world");
		
		DAO<Time> daoTime=new DAO<Time>();
		
		Time t=new Time();
		t.setEstado("rn");
		t.setNome("ABC");
		
		Jogador j1=new Jogador();
		j1.setNome("André");
		j1.setPosicao("Atacante");
		j1.setDataNascimento(null);
		t.getJogadores().add(j1);
		
		daoTime.gravar(t);
		
		resp.getWriter().println("Registro salvo com sucesso");
		
		
	}
}
